<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>스프링 테스트 예제</title>
		<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAeaAj2T1liHgvdC3tsqRWWhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxRhdOu_2cxA-HoLLWM-hCSW2MB4Iw&sensor=true_or_false" type="text/javascript"></script>
		<script type="text/javascript">    
			function initialize() {      
				if (GBrowserIsCompatible()) {        
					var map = new GMap2(document.getElementById("map_canvas"));
					var point = new GLatLng(37.4993106, 127.0352316);        
					map.setCenter(point, 17);        
					map.setUIToDefault();

					var marker = createMarker(point,'uzen'); 
					map.addOverlay(marker);
					//marker.openInfoWindowHtml("<font color='red'>UZEN!</font>");
				} else {
					alert("Sorry, the Google Maps API is not compatible with this browser");
				}
			}    

			function createMarker(point, html) {
		        var marker = new GMarker(point);
		        GEvent.addListener(marker, "click", 
				        function() {
		          			marker.openInfoWindowHtml(html);
		        		}
        		);
		        return marker;
		    }

			function search() {
				var address = document.getElementById("address").value; 
				var map = new GMap2(document.getElementById("map_canvas"));
				var geocoder = new GClientGeocoder();
				geocoder.getLatLng(address, 
						function (point){
							if (!point) {
								alert(address + " not found");
							} else { 
								map.setCenter(point, 18);
								map.setUIToDefault();
								
								var marker = new GMarker(point);
								map.addOverlay(marker);
								marker.openInfoWindowHtml(address)
							}
						}
				);
			}
		</script>
	</head>
	<body onload="initialize()" onunload="GUnload()">
		스프링 테스트 예제(spring test example) : 구글맵<br/>
		<br />
		<br />
		<div id="map_canvas" style="width: 500px; height: 300px"></div>
		<br />
		<br />
		<input type="text" id="address" />
		<button onclick="search()">검색</button>
		<br />
		<a href="/jude">1. 메인으로</a>
		<br />
		<a href="/jude/google/loadLocation.jude">2. getSysdate 테스트</a>
	</body>
</html>